﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using GCELibrary.Current;

namespace ZF.WS.expert
{
    public partial class HouseInfo : BLL.Page.PageBase
    {
        [PageArgument(Key = "hid", CanNull = false)]
        public int HouseId { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var dc = SiteInfo.CreateDBDataContext())
            {
                var dl = new System.Data.Linq.DataLoadOptions();
                dl.LoadWith<Model.H_House>(p => p.H_Rent);
                dl.LoadWith<Model.H_House>(p => p.H_Sell);
                dc.LoadOptions = dl;

                var iq = dc.H_House.Where(p => true);
                if (!(SiteInfo.GetCurrentMember() != null && SiteInfo.GetCurrentMember().UserType == UserType.Admin))
                {
                    iq = iq.Where(p => p.IsVerify);
                }
                var houseInfo = iq.FirstOrDefault(p => p.HouseId == HouseId);
                if (houseInfo == null)
                {
                    throw WarnFactory.CreateWarn("未找到该房源信息，可能该房源已经被删除", WarnIcon.Error, WarnLink.GoDefault);
                }
                this.HouseInfo1.House = houseInfo;
       
                 

                
            }
        }
    }
}
